import { defineStore } from 'pinia'
export interface FormatConfigItem {
  type: string
  font: string
  size: string
  location: {
    id: number
    value: string
    label: string
  }
}
export interface FormatConfigState {
  dataSource: FormatConfigItem[]
}

export const useFormatConfigStore = defineStore('formatConfig', {
  state: (): FormatConfigState => ({
    dataSource: [
      {
        type: '标题',
        font: '宋体',
        size: '一号',
        location: {
          id: 1,
          value: 'center',
          label: '居中',
        },
      },
      {
        type: '二级标题',
        font: '宋体',
        size: '二号',
        location: {
          id: 2,
          value: 'center',
          label: '居中',
        },
      },
      {
        type: '文本',
        font: '宋体',
        size: '小四',
        location: {
          id: 3,
          value: 'center',
          label: '居中',
        },
      },
      {
        type: '时间',
        font: '宋体',
        size: '小四',
        location: {
          id: 4,
          value: 'center',
          label: '居中',
        },
      },
      {
        type: '其他',
        font: '宋体',
        size: '小四',
        location: {
          id: 5,
          value: 'center',
          label: '居中',
        },
      },
      {
        type: '图片',
        font: '宋体',
        size: '--',
        location: {
          id: 6,
          value: 'center',
          label: '居中',
        },
      },
      {
        type: '表格文本',
        font: '宋体',
        size: '小四',
        location: {
          id: 7,
          value: 'center',
          label: '居中',
        },
      },
    ],
  }),
  getters: {
    doubleCount: (state) => state.dataSource,
  },
  actions: {
    increment() {
      this.dataSource = this.dataSource
    },
    async fetchUser() {},
  },
  persist: true, // 启用持久化
})
